<?php
namespace app\mobile\controller;

use app\model\Theme; 
use app\model\Worker; 

class WTuanrank extends Base
{
    public function W_tuanrank()
    {
global $_G, $_P;
$fans = $this->checkuser();
$themeid = intval($_P['themeid']);
if($themeid < 0){
	return_msg('管理后台地址不正确');
}
$system=$_G['system'];
$theme = Theme::getThemeById($themeid);
$config = 	Theme::getConfig($themeid);
if(empty($theme['id'])){
	return_msg('管理后台地址不正确');
}
$myworker = Worker::getThemeWorkerByOpenidNew($_G['openid'],$themeid);
if(!($system['ruanjian']!=3 || $config['showshop']==0 || ($system['ruanjian']==3 && $config['showshop']==$myworker['company']))){
	$myworker = "";
}
if (empty($myworker)) {
	return_msg('您不是员工,无权访问');
}
$msg = Worker::gethoutaistats();
if (!empty($msg)) {
	return_msg($msg);
}

$tuanranklist = db_select("SELECT * FROM ".tablename(t_record)."
                            WHERE  themeid =" . $themeid ." and status > 0 and type = 0 ORDER BY tuannum desc,addtime desc limit 100");


if($_G['companyname'] =='新飞驰软件'){
	$return_clicent = get_defined_vars();
return view('/fcworker/fc_tuanrank' , $return_clicent);
}else{
	$return_clicent = get_defined_vars();
return view('/yxworker/w_tuanrank' , $return_clicent);
}
}
}